import java.util.Scanner;
//1为正号
//0为符号
//头节点表示正负号
public class Test {
    public static Node creatNum() {
        Node head=new Node();
        Scanner scanner = new Scanner(System.in);
        String str=scanner.nextLine();
        //判断正负号
        if(str.charAt(0)=='-') {
            head.val=0;
        } else {
            head.val=1;
        }
        for(int i=str.length()-1;i>=0;i--) {
            Node newNode = new Node(str.charAt(i)-'0');
            if(head.next==null) {
                head.next=newNode;
                newNode.prev=head;
            } else {
                newNode.prev = head;
                newNode.next = head.next;
                head.next.prev = newNode;
                head.next = newNode;
            }
        }
        return head;
    }
    public static void displayNum(Node head) {
        Node cur=head.next;
        while(cur!=null) {
            System.out.print(cur.val);
            cur=cur.next;
        }
        System.out.println();
    }
    public static Node max(Node head1,Node head2) {
        int count1=0;
        int count2=0;
        Node cur=head1.next;
        while(cur!=null) {
            count1++;
            cur=cur.next;
        }
        cur=head2.next;
        while(cur!=null) {
            count2++;
            cur=cur.next;
        }
        return count1>count2?head1:head2;
    }
    public static Node plusNum(Node head1,Node head2) {
        if(head1.)
    }
    public static void main(String[] args) {
        Node head1=creatNum();
        Node head2=creatNum();
        displayNum(head1);
        displayNum(head2);

    }
}
